﻿@using MvcApplication.Entity
@model Category
@{
    Layout = "~/Views/Shared/_Public.cshtml";
    ViewBag.Title = SiteInfoSession.SiteInfo.Name;
    PaginationResult<Post> posts = ViewBag.Posts;   
}
<div class="column category_main">
    <div class="col-4-3">
        @foreach (var post in posts.Datas)
        {
            <div class="column list_block">
                <div class="col-4-1">
                    <img src="/image?path=@post.FirstPicture" class="first_picture" />
                </div>
                <div>
                    <h2 class="list_title">
                        <a href="/post_@post.ID">@post.Title</a> 
                        <small>-@post.CreateAt.ToString("yyyy-MM-dd")</small>
                    </h2>
                </div>
            </div>
        }
        <div id="page_list"></div>
    </div>
    <div class="col-4-1 last">
        ds
    </div>
</div>

@section scripts{
    <script>
        laypage({
            cont: 'page_list',
            pages: @posts.PageCount,
            jump: function (e, first) { //触发分页后的回调
                if (!first) { //一定要加此判断，否则初始时会无限刷新
                    location.href = '/category_@Model.ID?pageIndex=' + e.curr;
                }
            }
        });
    </script>
}